/**
 * Filename: SpacesItemDecoration.java
 * @author  Firefly
 * @contact postfirefly@163.com
 * @time    2016/3/6 16:38
 */
package com.github.postsanf.yinian.view;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

public class SpacesItemDecoration extends RecyclerView.ItemDecoration {

	private int space;

	public SpacesItemDecoration(int space) {
		this.space=space;
	}

	@Override
	public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
		outRect.left=space;
		outRect.right=space;
		outRect.bottom=space;
		if(parent.getChildAdapterPosition(view)==0){
			outRect.top=space;
		}
	}
}